/**
 * ------------------------------------------------------------*
 *          COPYRIGHT (C) 2006 BOCO Inter-Telecom INC          *
 *   CONFIDENTIAL AND PROPRIETARY. ALL RIGHTS RESERVED.        *
 *                                                             *
 *  This work contains confidential business information       *
 *  and intellectual property of BOCO  Inc, Beijing, CN.       *
 *  All rights reserved.                                       *
 * ------------------------------------------------------------*
 *
 *
 */
/**
 *Revision Information:
 *
 *@version 1.0 2006-3-21 release(zhanglei)
 */

package com.boco.webmaster.model;

import java.util.*;
import com.boco.transnms.server.bo.misc.EnumBO;
import com.boco.transnms.client.model.base.IBoCommand;
import com.boco.transnms.client.model.base.BoCmdFactory;
import com.boco.transnms.server.bo.helper.misc.EnumBOHelper;
import com.boco.common.util.lang.GenericEnum;
import com.boco.transnms.common.dto.base.DataObjectList;
import org.apache.struts.util.LabelValueBean;

public class DdAppTypeModel {
    private static DdAppTypeModel instance = new DdAppTypeModel();
    private Map ddAppTypeMap = new HashMap();
    public DdAppTypeModel() {
        refresh();
    }

    public void refresh(){
        String enmuName = EnumBO.EnumName.DD_ALL_APP_TYPE;
        IBoCommand cmd = BoCmdFactory.getInstance().createBoCmd(EnumBOHelper.ActionName.getEnum, new Object[] {enmuName});
        GenericEnum ddAppType = (GenericEnum) cmd.exec();
        String[] ddAppTypeEnum = ddAppType.getAllNames();
        for (int i = 0; i < ddAppTypeEnum.length; i++) {
            ddAppTypeMap.put(ddAppType.getValue(ddAppTypeEnum[i]),ddAppTypeEnum[i]);
        }
    }

    public static DdAppTypeModel getInstance(){
        return instance;
    }

    public String getValue(long key){
        return (String)ddAppTypeMap.get(key);
    }
    public List getAllDdApp() {
        Iterator i = ddAppTypeMap.keySet().iterator();
        List attempTypes = new ArrayList();
        while (i.hasNext()) {
         String ddAppTypeEnum =  (String)ddAppTypeMap.get(i.next());
         attempTypes.add(new LabelValueBean(ddAppTypeEnum,i.next().toString() + ""));
        }

        return attempTypes;
    }

}
